package com.wenan.ui.homePages.statisticsControl
{
	
	import com.wenan.AppGlobal;
	
	import mx.containers.HBox;
	import mx.controls.Image;
	import mx.core.ScrollPolicy;
	import mx.graphics.BitmapFill;
	
	import spark.components.Group;
	import spark.components.Label;
	import spark.primitives.Rect;
	import spark.primitives.supportClasses.FilledElement;
	
	public class StatisticsItem2 extends Group
	{
		private var _itemUrl:String;
		private var _itemName:String;
		private var _itemValue:String;
		private var _itemUnit:String;
		
		public function StatisticsItem2(itemUrl:String,itemName:String,itemValue:String,itemUnit:String)
		{
			super();
			this._itemUrl = itemUrl;
			this._itemName = itemName;
			this._itemValue = itemValue;
			this._itemUnit = itemUnit;
			
			initControls();
		}
		
		private function initControls():void
		{
			
			var image1:Image = new Image();
			image1.source = "images/assets/msg/row_bg.png";
			image1.x = 0;
			image1.y = 2;
			image1.percentWidth = 100;
			image1.percentHeight = 100;
			image1.setStyle("verticalCenter","0");
			image1.setStyle("autoLoad","true");
			addElement(image1);
			
			var image2:Image = new Image();
			image2.x = 0;
			image2.y = 3;
			image2.source = AppGlobal.commonUrl +_itemUrl;
			image2.setStyle("left","3");
			image2.width = 24;
			image2.height = 19
			image2.setStyle("verticalCenter","0");
			addElement(image2);
			
			var nameLabel:Label = new Label();
			nameLabel.text = _itemName;
			nameLabel.setStyle("left","27");
			nameLabel.setStyle("color","#215b8d");
			nameLabel.setStyle("fontSize","11");
			nameLabel.setStyle("fontWeight","bold");
			nameLabel.setStyle("verticalCenter","0");
			addElement(nameLabel);
			
			var image3:Image = new Image();
			image2.x = 0;
			image1.y = 3;
			image3.width = 70;
			image3.height = 19;
			image3.source = "images/assets/msg/text_bg2.png";
			image3.setStyle("right","30");
			image3.setStyle("verticalCenter","0");
			image1.setStyle("autoLoad","true");
			image1.setStyle("maintainAspectRatio","true");
			addElement(image3);
			
			var valueLabel:Label = new Label();
			valueLabel.text = _itemValue;
			valueLabel.setStyle("color","#ffffff");
			valueLabel.setStyle("fontSize","12");
			valueLabel.setStyle("right","33")
			valueLabel.setStyle("verticalCenter","0");
			addElement(valueLabel);
			
			var unitLabel:Label = new Label();
			unitLabel.text = _itemUnit;
			unitLabel.setStyle("color","#215b8d");
			unitLabel.setStyle("fontSize","11");
			unitLabel.setStyle("fontWeight","bold");
			unitLabel.setStyle("right","10");
			unitLabel.setStyle("verticalCenter","0");
			addElement(unitLabel);
		}
		
	}
}